// primitives.hpp : Primitives. Intersection and surface normal evaluation
//

#ifndef PRIMITIVES_HPP_INCLUDE
#define PRIMITIVES_HPP_INCLUDE


#include "types.hpp"


namespace Renderer
{


class Primitive
{
protected:
	Primitive();
public:
	enum {NO_INTERSECTION, FRONT_INTERSECTION, BACKFACE_INTERSECTION};
	virtual int getIntersection(const Ray& ray, double& dist) const;
	virtual Vector3 getNormal(const Vector3& position) const;
	const char* getType() const;
};

class Sphere : public Primitive
{
private:
	Vector3 origin_;
	double radius_;
public:
	Sphere(const Vector3& origin, double radius);
	int getIntersection(const Ray& ray, double& dist) const;
	Vector3 getNormal(const Vector3& position) const;
	const char* getType() const;
};

class Plane : public Primitive
{
private:
	Vector3 origin_;
	Vector3 normal_;
public:
	Plane(const Vector3& origin, const Vector3& normal);
	int getIntersection(const Ray& ray, double& dist) const;
	Vector3 getNormal(const Vector3& position) const;
	const char* getType() const;
};


class Triangle : public Primitive
{
private:
	Vector3 p1, p2, p3;
	Vector3 n1, n2, n3;
public:
};


} // namespace Renderer


#endif //PRIMITIVES_HPP_INCLUDE
